﻿using System;
using System.Web.Caching;
using DotNetNuke.Common.Utilities;
using DotNetNuke.ComponentModel.DataAnnotations;
using DotNetNuke.Entities.Content;

namespace CorpGroup.Modules.cgDocuments.Components
{
    //PetaPoco Specify which table using the IMapper
    [TableName("cgDocuments_Docs")]
    //setup the primary key for table
    [PrimaryKey("DocId", AutoIncrement = true)]
    //scope the objects to the ModuleId of a module on a page (or copy of a module on a page)
    [Scope("ModuleId")]
    //configure caching using PetaPoco
    [Cacheable("Documents", CacheItemPriority.Default, 20)]
    //[DeclareColumns] //This forces all columns to have either an include or they will be ignored
    public class Document 
    {
        ///<summary>
        /// The ID of your object with the name of the DocumentName
        ///</summary>
        //Note this convention would be used when column names don't match
        //[ColumnName("ID")]
        public int DocId { get; set; }
        ///<summary>
        /// A string with the name of the ItemName
        ///</summary>
        public string DocTitle { get; set; }

        ///<summary>
        /// A string with the description of the object
        ///</summary>
        public string DocDescription { get; set; }

        ///<summary>
        /// A string with the location of the document on the web server
        /// </summary>
        //This forces the column to be included or [IgnoreColumn] ignores the column
        //[IncludeColumn]
        public string DocPath { get; set; }
        
        ///<summary>
        /// An int with the orders of the documents on the web server
        /// </summary>
        public int DocSortOrderId { get; set; }

        ///<summary>
        /// The ModuleId of where the object was created and gets displayed
        ///</summary>
        public int ModuleId { get; set; }

        ///<summary>
        /// An integer for the user id of the user who created the object
        ///</summary>
        public int CreatedByUserId { get; set; }

        ///<summary>
        /// An integer for the user id of the user who last updated the object
        ///</summary>
        public int LastModifiedByUserId { get; set; }

        ///<summary>
        /// The date the object was created
        ///</summary>
        public DateTime CreatedOnDate { get; set; }

        ///<summary>
        /// The date the object was updated
        ///</summary>
        public DateTime LastModifiedOnDate { get; set; }
        
    }
}